package org.momo.rpc.service;

import lombok.extern.slf4j.Slf4j;
import org.momo.rpc.constant.LoadBalanceKey;
import org.momo.rpc.springboot.starter.annotion.RpcMethod;
import org.momo.rpc.springboot.starter.annotion.RpcReference;
import org.momo.rpc.api.UserService;
import org.momo.rpc.api.model.User;
import org.springframework.stereotype.Service;


@Slf4j
@Service
public class MyUserService {
    @RpcReference(
            serviceName = "user",
            serviceVersion = "v1.0",
            methodConfigs = {
                    @RpcMethod(methodName = "queryUserById", loadBalancer = LoadBalanceKey.POLLING)
            }
    )
    public UserService userService;

    public User getUser(Long id) {
        return userService.queryUserById(id);
    }
}
